/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * SAIMS.java
 *
 * Created on 14-Mar-2011, 14:17:49
 */
package inventorymanagement;

import interact.iLogin;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Timer;

/**
 *
 * @author dung
 */
public class SAIMS extends javax.swing.JFrame implements ActionListener{

    private Calendar calendar = Calendar.getInstance();
    private SimpleDateFormat TimeFormat = new SimpleDateFormat("HH:mm:ss");
    private SimpleDateFormat Format = new SimpleDateFormat("EEEEEEE, dd MMMM yyyy");
    Timer timer = new Timer(100, this);
    /** Creates new form SAIMS */
    public SAIMS() throws ClassNotFoundException, SQLException {
        initComponents();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        this.setLocation(((int) screenSize.getWidth() - this.getWidth()) / 2, ((int) screenSize.getHeight() - this.getHeight()) / 2);
        permissing();
        actionPerformed(null);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        mnuSystem = new javax.swing.JMenu();
        mniLogin = new javax.swing.JMenuItem();
        mniLogout = new javax.swing.JMenuItem();
        mniChangePass = new javax.swing.JMenuItem();
        mniExit = new javax.swing.JMenuItem();
        mnuOption = new javax.swing.JMenu();
        mniDatabase = new javax.swing.JMenuItem();
        mnuAM = new javax.swing.JMenu();
        mniAddAcount = new javax.swing.JMenuItem();
        mniAddItems = new javax.swing.JMenuItem();
        mnuSLM = new javax.swing.JMenu();
        mniSMCheck = new javax.swing.JMenuItem();
        mniSMRead = new javax.swing.JMenuItem();
        mniChart = new javax.swing.JMenuItem();
        mnuIM = new javax.swing.JMenu();
        mniCheckInv = new javax.swing.JMenuItem();
        btnCheckReceipt = new javax.swing.JMenuItem();
        btnCheckReport = new javax.swing.JMenuItem();
        mnuSL = new javax.swing.JMenu();
        mnCustomerSL = new javax.swing.JMenuItem();
        mnSearchItemSL = new javax.swing.JMenuItem();
        mnProduceBillSL = new javax.swing.JMenuItem();
        mnCreateReport = new javax.swing.JMenuItem();
        mnuHelp = new javax.swing.JMenu();
        mniHelp = new javax.swing.JMenuItem();
        mniAbout = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        time = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);
        getContentPane().setLayout(new java.awt.CardLayout());

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel3.setText("Sale And Inventory Management");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel4.setText("Group");

        jLabel5.setText("Nguyen Tuan Dung");

        jLabel6.setText("Bui Van Truong");

        jLabel7.setText("Vu Ngoc Giang");

        jLabel8.setText("Mai Viet Anh");

        jLabel9.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel9.setText("Falcuty");

        jLabel10.setText("Nguyen Duy Hoang");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(23, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE))))
                        .addGap(10, 10, 10))))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel5)
                .addGap(18, 18, 18)
                .addComponent(jLabel6)
                .addGap(18, 18, 18)
                .addComponent(jLabel7)
                .addGap(18, 18, 18)
                .addComponent(jLabel8)
                .addGap(27, 27, 27)
                .addComponent(jLabel9)
                .addGap(18, 18, 18)
                .addComponent(jLabel10)
                .addContainerGap(239, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel3.setLayout(new java.awt.CardLayout());

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/inventory-management-1.jpg"))); // NOI18N
        jPanel3.add(jLabel2, "card2");

        jPanel4.setLayout(new java.awt.CardLayout());

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/SAIMS.jpg"))); // NOI18N
        jPanel4.add(jLabel1, "card2");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel3, 0, 0, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        getContentPane().add(jPanel1, "card2");

        mnuSystem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/location1.png"))); // NOI18N
        mnuSystem.setText("System"); // NOI18N

        mniLogin.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
        mniLogin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/login_icon.gif"))); // NOI18N
        mniLogin.setText("Login"); // NOI18N
        mniLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniLoginActionPerformed1(evt);
            }
        });
        mnuSystem.add(mniLogin);

        mniLogout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.CTRL_MASK));
        mniLogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/logout2.jpg"))); // NOI18N
        mniLogout.setText("Log out"); // NOI18N
        mniLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniLogoutActionPerformed(evt);
            }
        });
        mnuSystem.add(mniLogout);

        mniChangePass.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
        mniChangePass.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/changepass.png"))); // NOI18N
        mniChangePass.setText("Change Password"); // NOI18N
        mniChangePass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniChangePassActionPerformed(evt);
            }
        });
        mnuSystem.add(mniChangePass);

        mniExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
        mniExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/cancel.jpg"))); // NOI18N
        mniExit.setText("Exit "); // NOI18N
        mniExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniExitActionPerformed(evt);
            }
        });
        mnuSystem.add(mniExit);

        mnuOption.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/23.JPG"))); // NOI18N
        mnuOption.setText("Option"); // NOI18N

        mniDatabase.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK));
        mniDatabase.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/23.JPG"))); // NOI18N
        mniDatabase.setText("Database"); // NOI18N
        mniDatabase.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniDatabaseActionPerformed(evt);
            }
        });
        mnuOption.add(mniDatabase);

        mnuSystem.add(mnuOption);

        jMenuBar1.add(mnuSystem);

        mnuAM.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/than.gif"))); // NOI18N
        mnuAM.setText("Administrator"); // NOI18N

        mniAddAcount.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mniAddAcount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/add.jpg"))); // NOI18N
        mniAddAcount.setText("Account Manager"); // NOI18N
        mniAddAcount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniAddAcountActionPerformed(evt);
            }
        });
        mnuAM.add(mniAddAcount);

        mniAddItems.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mniAddItems.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/dangki_2.gif"))); // NOI18N
        mniAddItems.setText("Add Items/Categories"); // NOI18N
        mniAddItems.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniAddItemsActionPerformed(evt);
            }
        });
        mnuAM.add(mniAddItems);

        jMenuBar1.add(mnuAM);

        mnuSLM.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/than.gif"))); // NOI18N
        mnuSLM.setText("Sales Manager");

        mniSMCheck.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mniSMCheck.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/ok.png"))); // NOI18N
        mniSMCheck.setText("Check statistics");
        mniSMCheck.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniSMCheckActionPerformed(evt);
            }
        });
        mnuSLM.add(mniSMCheck);

        mniSMRead.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mniSMRead.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/ok.png"))); // NOI18N
        mniSMRead.setText("Read Report");
        mniSMRead.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniSMReadActionPerformed(evt);
            }
        });
        mnuSLM.add(mniSMRead);

        mniChart.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mniChart.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/ok.png"))); // NOI18N
        mniChart.setText("Generate chart");
        mniChart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniChartActionPerformed(evt);
            }
        });
        mnuSLM.add(mniChart);

        jMenuBar1.add(mnuSLM);

        mnuIM.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/than.gif"))); // NOI18N
        mnuIM.setText("Inventory Manager"); // NOI18N

        mniCheckInv.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mniCheckInv.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/ok.png"))); // NOI18N
        mniCheckInv.setText("Check statistics"); // NOI18N
        mniCheckInv.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniCheckInvActionPerformed(evt);
            }
        });
        mnuIM.add(mniCheckInv);

        btnCheckReceipt.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        btnCheckReceipt.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/ok.png"))); // NOI18N
        btnCheckReceipt.setText("Check Receipt");
        btnCheckReceipt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCheckReceiptActionPerformed(evt);
            }
        });
        mnuIM.add(btnCheckReceipt);

        btnCheckReport.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        btnCheckReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/ok.png"))); // NOI18N
        btnCheckReport.setText("Read Report");
        btnCheckReport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCheckReportActionPerformed(evt);
            }
        });
        mnuIM.add(btnCheckReport);

        jMenuBar1.add(mnuIM);

        mnuSL.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/than.gif"))); // NOI18N
        mnuSL.setText("Sales"); // NOI18N

        mnCustomerSL.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnCustomerSL.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/admin_batch_delete_members_form.gif"))); // NOI18N
        mnCustomerSL.setText("Search Customer");
        mnCustomerSL.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnCustomerSLActionPerformed(evt);
            }
        });
        mnuSL.add(mnCustomerSL);

        mnSearchItemSL.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnSearchItemSL.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/search.gif"))); // NOI18N
        mnSearchItemSL.setText("Search Item");
        mnSearchItemSL.setPreferredSize(new java.awt.Dimension(200, 26));
        mnSearchItemSL.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnSearchItemSLActionPerformed(evt);
            }
        });
        mnuSL.add(mnSearchItemSL);

        mnProduceBillSL.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnProduceBillSL.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/makeTransfer.png"))); // NOI18N
        mnProduceBillSL.setText("Produce Bill");
        mnProduceBillSL.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnProduceBillSLActionPerformed(evt);
            }
        });
        mnuSL.add(mnProduceBillSL);

        mnCreateReport.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnCreateReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/13.JPG"))); // NOI18N
        mnCreateReport.setText("Create Report");
        mnCreateReport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnCreateReportActionPerformed(evt);
            }
        });
        mnuSL.add(mnCreateReport);

        jMenuBar1.add(mnuSL);

        mnuHelp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/Symbol-Help.png"))); // NOI18N
        mnuHelp.setText("Help"); // NOI18N

        mniHelp.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        mniHelp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/help.jpg"))); // NOI18N
        mniHelp.setText("Help"); // NOI18N
        mnuHelp.add(mniHelp);

        mniAbout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F10, 0));
        mniAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/Symbol-Information.png"))); // NOI18N
        mniAbout.setText("About"); // NOI18N
        mniAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniAboutActionPerformed(evt);
            }
        });
        mnuHelp.add(mniAbout);

        jMenuBar1.add(mnuHelp);

        jMenu1.setText("                                                                  ");
        jMenuBar1.add(jMenu1);

        time.setText("time");
        time.setEnabled(false);
        jMenuBar1.add(time);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mniSMCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniSMCheckActionPerformed
        // TODO add your handling code here:
        SalesManager sm = new SalesManager();
        sm.setVisible(true);
    }//GEN-LAST:event_mniSMCheckActionPerformed

    private void mniDatabaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniDatabaseActionPerformed
        // TODO add your handling code here:
        DBConfig dbc = new DBConfig(null, true);
        dbc.setVisible(true);
    }//GEN-LAST:event_mniDatabaseActionPerformed

    private void mniLoginActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniLoginActionPerformed1
        // TODO add your handling code here:
        this.dispose();
        Login lg = new Login();
        lg.setVisible(true);
    }//GEN-LAST:event_mniLoginActionPerformed1

    private void mniCheckInvActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniCheckInvActionPerformed
        // TODO add your handling code here:
        InventoryManager inv = new InventoryManager();
        inv.setVisible(true);
    }//GEN-LAST:event_mniCheckInvActionPerformed

    private void mniChangePassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniChangePassActionPerformed
        // TODO add your handling code here:
        ChangePassword cp = new ChangePassword();
        cp.setVisible(true);
    }//GEN-LAST:event_mniChangePassActionPerformed

    private void mniLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniLogoutActionPerformed
        try {
            // TODO add your handling code here:
            this.dispose();
            iLogin.setPermit(null);
            SAIMS saims = new SAIMS();
            saims.setVisible(true);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(SAIMS.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(SAIMS.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_mniLogoutActionPerformed

    private void mniExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniExitActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_mniExitActionPerformed

    private void mniAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniAboutActionPerformed
        // TODO add your handling code here:
        frmAbout a = new frmAbout();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        a.setLocation(((int) screenSize.getWidth() - a.getWidth()) / 2, ((int) screenSize.getHeight() - a.getHeight()) / 2);
        a.setVisible(true);
    }//GEN-LAST:event_mniAboutActionPerformed

    private void mnCustomerSLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnCustomerSLActionPerformed
        // TODO add your handling code here:
        frmCustomer frmcus = new frmCustomer();
        frmcus.setVisible(true);
    }//GEN-LAST:event_mnCustomerSLActionPerformed

    private void mnSearchItemSLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnSearchItemSLActionPerformed
        // TODO add your handling code here:
        frmSearchItems frmseIt = new frmSearchItems();
        frmseIt.setVisible(true);
    }//GEN-LAST:event_mnSearchItemSLActionPerformed

    private void mnProduceBillSLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnProduceBillSLActionPerformed
        // TODO add your handling code here:
        frmProcedureBill frmproduce = new frmProcedureBill();
        frmproduce.setVisible(true);
    }//GEN-LAST:event_mnProduceBillSLActionPerformed

    private void mniAddItemsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniAddItemsActionPerformed
        // TODO add your handling code here:
        ItemManager im = new ItemManager();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        im.setLocation(((int) screenSize.getWidth() - im.getWidth()) / 2, ((int) screenSize.getHeight() - im.getHeight()) / 2);
        im.setVisible(true);
}//GEN-LAST:event_mniAddItemsActionPerformed

    private void mniAddAcountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniAddAcountActionPerformed
        // TODO add your handling code here:
        AccountManager am = new AccountManager();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        am.setLocation(((int) screenSize.getWidth() - am.getWidth()) / 2, ((int) screenSize.getHeight() - am.getHeight()) / 2);
        am.setVisible(true);
}//GEN-LAST:event_mniAddAcountActionPerformed

    private void btnCheckReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckReportActionPerformed
        // TODO add your handling code here:
        ReadReport ReadRP = new ReadReport();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        ReadRP.setLocation(((int) screenSize.getWidth() - ReadRP.getWidth()) / 2, ((int) screenSize.getHeight() - ReadRP.getHeight()) / 2);
        ReadRP.setVisible(true);
}//GEN-LAST:event_btnCheckReportActionPerformed

    private void btnCheckReceiptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckReceiptActionPerformed
        // TODO add your handling code here:
        ValidReceipt ValidRC = new ValidReceipt();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        ValidRC.setLocation(((int) screenSize.getWidth() - ValidRC.getWidth()) / 2, ((int) screenSize.getHeight() - ValidRC.getHeight()) / 2);
        ValidRC.setVisible(true);
}//GEN-LAST:event_btnCheckReceiptActionPerformed

    private void mnCreateReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnCreateReportActionPerformed
        // TODO add your handling code here:
        frmReport frmreport = new frmReport();
        frmreport.setVisible(true);
    }//GEN-LAST:event_mnCreateReportActionPerformed

    private void mniSMReadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniSMReadActionPerformed
        // TODO add your handling code here:
        ReadReport ReadRP = new ReadReport();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        ReadRP.setLocation(((int) screenSize.getWidth() - ReadRP.getWidth()) / 2, ((int) screenSize.getHeight() - ReadRP.getHeight()) / 2);
        ReadRP.setVisible(true);
    }//GEN-LAST:event_mniSMReadActionPerformed

    private void mniChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniChartActionPerformed
        // TODO add your handling code here:
        salesChart sc = new salesChart();
        sc.setVisible(true);
    }//GEN-LAST:event_mniChartActionPerformed
    public void permissing() throws ClassNotFoundException, SQLException {
        if (iLogin.getPermit() == null) {
            mnuSystem.setEnabled(true);
            mnuAM.setEnabled(false);
            mnuSL.setEnabled(false);
            mnuSLM.setEnabled(false);
            mnuIM.setEnabled(false);
            mnuHelp.setEnabled(true);
            mniLogout.setVisible(false);
            mniChangePass.setVisible(false);
        } else if (iLogin.getPermit().equals("AM")) {
            mnuSystem.setEnabled(true);
            mnuAM.setEnabled(true);
            mnuSL.setEnabled(false);
            mnuSLM.setEnabled(false);
            mnuIM.setEnabled(false);
            mnuHelp.setEnabled(true);
            mniLogin.setVisible(false);
        } else if (iLogin.getPermit().equals("SL")) {
            mnuSystem.setEnabled(true);
            mnuAM.setEnabled(false);
            mnuSL.setEnabled(true);
            mnuSLM.setEnabled(false);
            mnuIM.setEnabled(false);
            mnuHelp.setEnabled(true);
            mniLogin.setVisible(false);
        } else if (iLogin.getPermit().equals("SLM")) {
            mnuSystem.setEnabled(true);
            mnuAM.setEnabled(false);
            mnuSL.setEnabled(false);
            mnuSLM.setEnabled(true);
            mnuIM.setEnabled(false);
            mnuHelp.setEnabled(true);
            mniLogin.setVisible(false);
        } else {
            mnuSystem.setEnabled(true);
            mnuAM.setEnabled(false);
            mnuSL.setEnabled(false);
            mnuSLM.setEnabled(false);
            mnuIM.setEnabled(true);
            mnuHelp.setEnabled(true);
            mniLogin.setVisible(false);
        }
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem btnCheckReceipt;
    private javax.swing.JMenuItem btnCheckReport;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JMenuItem mnCreateReport;
    private javax.swing.JMenuItem mnCustomerSL;
    private javax.swing.JMenuItem mnProduceBillSL;
    private javax.swing.JMenuItem mnSearchItemSL;
    private javax.swing.JMenuItem mniAbout;
    private javax.swing.JMenuItem mniAddAcount;
    private javax.swing.JMenuItem mniAddItems;
    private javax.swing.JMenuItem mniChangePass;
    private javax.swing.JMenuItem mniChart;
    private javax.swing.JMenuItem mniCheckInv;
    private javax.swing.JMenuItem mniDatabase;
    private javax.swing.JMenuItem mniExit;
    private javax.swing.JMenuItem mniHelp;
    private javax.swing.JMenuItem mniLogin;
    private javax.swing.JMenuItem mniLogout;
    private javax.swing.JMenuItem mniSMCheck;
    private javax.swing.JMenuItem mniSMRead;
    private javax.swing.JMenu mnuAM;
    private javax.swing.JMenu mnuHelp;
    private javax.swing.JMenu mnuIM;
    private javax.swing.JMenu mnuOption;
    private javax.swing.JMenu mnuSL;
    private javax.swing.JMenu mnuSLM;
    private javax.swing.JMenu mnuSystem;
    private javax.swing.JMenu time;
    // End of variables declaration//GEN-END:variables

    public void actionPerformed(ActionEvent e) {
        this.timer.start();
        this.calendar.setTimeInMillis(System.currentTimeMillis());
        time.setText(this.Format.format(this.calendar.getTime()).toString() + " - " + this.TimeFormat.format(this.calendar.getTime()).toString());
    }
}
